import {GameFrameworkEventArgs} from "../Base/GameFrameworkEventArgs";
import {ISoundAgent} from "./ISoundAgent";
import {ReferencePool} from "../Base/ReferencePool/ReferencePool";

export class PlaySoundSuccessEventArgs extends GameFrameworkEventArgs{
    get serialId(): number {
        return this._serialId;
    }

    get soundAssetName(): string {
        return this._soundAssetName;
    }

    get soundAgent(): ISoundAgent {
        return this._soundAgent;
    }

    get duration(): number {
        return this._duration;
    }

    get userData() {
        return this._userData;
    }

    private _serialId:number;
    private _soundAssetName:string;
    private _soundAgent:ISoundAgent;
    private _duration:number;
    private _userData;


    constructor() {
        super();
        this._serialId = 0;
        this._soundAssetName = null;
        this._soundAgent = null;
        this._duration = 0;
        this._userData = null;
    }

    public static Create(serialId:number,soundAssetName:string,soundAgent:ISoundAgent,duration:number,userData):PlaySoundSuccessEventArgs {
        let playSoundSuccessEventArgs:PlaySoundSuccessEventArgs = ReferencePool.Acquire(PlaySoundSuccessEventArgs);
        playSoundSuccessEventArgs._serialId = serialId;
        playSoundSuccessEventArgs._soundAssetName = soundAssetName;
        playSoundSuccessEventArgs._soundAgent = soundAgent;
        playSoundSuccessEventArgs._duration = duration;
        playSoundSuccessEventArgs._userData = userData;
        return playSoundSuccessEventArgs;
    }


    Clear(): void {
        this._serialId = 0;
        this._soundAssetName = null;
        this._soundAgent = null;
        this._duration = 0;
        this._userData = null;
    }

}